 task Stage1 {
  loop {
   if(title == 1 || title == 2) { //^CgʒȂ{}s
    yield;
   }
   else if(count == 1 && title == 3) {
    PlayMusic(bgm1);
    wait(30);
    hyousei1E(0);
    wait(180);
    hyousei1e(1);
    wait(180);
    hyousei1ee(2, 1);
    wait(300);
    hyousei2e(1);
    wait(500);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\`mʏeP-Easy-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(500);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\Pʃ{X-Easy-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    ClearStage;
   }
   else if(count == 2 && title == 3) {
    PlayMusic(bgm1);
    wait(30);
    hyousei1N(0);
    wait(180);
    hyousei1n(1);
    wait(180);
    hyousei1nn(2, 1);
    wait(300);
    hyousei2n(1);
    wait(500);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\`mʏeP-Normal-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\Pʃ{X-Normal-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    ClearStage;
   }
   else if(count == 3 && title == 3) {
    PlayMusic(bgm1);
    wait(30);
    hyousei1H(0);
    wait(180);
    hyousei1h(1);
    wait(180);
    hyousei1hh(2, 1);
    wait(300);
    hyousei2h(1);
    wait(500);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\Pʒ{X-Hard-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\Pʃ{X-Hard-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    ClearStage;
   }
   else if(count == 4 && title == 3) {
    PlayMusic(bgm1);
    wait(30);
    hyousei1L(0);
    wait(180);
    hyousei1l(1);
    wait(180);
    hyousei1ll(2, 1);
    wait(300);
    hyousei2l(1);
    wait(500);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\Pʒ{X-Lunatic-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    CreateEnemyBossFromFile(GetCurrentScriptDirectory~"P\Pʃ{X-Lunatic-.txt", 0, 0, 0, 0, 0);
    waitZero();
    wait(240);
    ClearStage;
   }
  }
 }

 function wait(w) {
  loop(w) { yield; }
 }

 function waitZero() {
  while(GetEnemyNum() != 0) { yield; }
 }

 function Select(expr, truenum, falsenum) {
  if(expr) {
   return truenum;
  }
  else {
   return falsenum;
  }
 }

 function hyousei1E(way) {
  plus = 1;
  loop(2) {
   wait(180);
   loop(9) {
    wait(18);
    let x = 40;
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Easy-.txt", Select(plus < 0, GetClipMaxX, GetClipMinX) + (x * plus), 0, 2, 90, Select(plus < 0, 1 + way * 2, way * 2));
    x += 24;
   }
   plus = -plus;
  }
 }

 function hyousei1e(way) {
  loop(2) {
  let x = GetClipMinX + 10;
  let move = 1;
   wait(120);
   loop(10) {
    wait(30);
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Easy-.txt", x, 0, 2, 90, move * way);
    x += (GetClipMaxX - 10) / 10;
    move += 1;
    if(move == 11) {
     move = 1;
     x = GetClipMinX + 10;
    }
   }
  }
 }

 function hyousei1ee(way, way2) {
  let x = 0;
  loop(way) {
   wait(180);
   loop(10) {
    wait(35);
    loop(way2) {
     CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Easy-.txt", x, GetClipMinY, 2, 90, 0);
     x = rand(GetClipMinX, GetClipMaxX);
    }
   }
  }
 }

 function hyousei1N(way) {
  plus = 1;
  loop(2) {
   wait(180);
   loop(9) {
    wait(18);
    let x = 40;
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Normal-.txt", Select(plus < 0, GetClipMaxX, GetClipMinX) + (x * plus), 0, 2, 90, Select(plus < 0, 1 + way * 2, way * 2));
    x += 24;
   }
   plus = -plus;
  }
 }

 function hyousei1n(way) {
  loop(2) {
  let x = GetClipMinX + 10;
  let move = 1;
   wait(120);
   loop(10) {
    wait(30);
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Normal-.txt", x, 0, 2, 90, move * way);
    x += (GetClipMaxX - 10) / 10;
    move += 1;
    if(move == 11) {
     move = 1;
     x = GetClipMinX + 10;
    }
   }
  }
 }

 function hyousei1nn(way, way2) {
  let x = 0;
  loop(way) {
   wait(180);
   loop(10) {
    wait(35);
    loop(way2) {
     CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Normal-.txt", x, GetClipMinY, 2, 90, 0);
     x = rand(GetClipMinX, GetClipMaxX);
    }
   }
  }
 }

 function hyousei1H(way) {
  plus = 1;
  loop(2) {
   wait(180);
   loop(9) {
    wait(18);
    let x = 40;
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Hard-.txt", Select(plus < 0, GetClipMaxX, GetClipMinX) + (x * plus), 0, 2, 90, Select(plus < 0, 1 + way * 2, way * 2));
    x += 24;
   }
   plus = -plus;
  }
 }

 function hyousei1h(way) {
  loop(2) {
  let x = GetClipMinX + 10;
  let move = 1;
   wait(120);
   loop(10) {
    wait(30);
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Hard-.txt", x, 0, 2, 90, move * way);
    x += (GetClipMaxX - 10) / 10;
    move += 1;
    if(move == 11) {
     move = 1;
     x = GetClipMinX + 10;
    }
   }
  }
 }

 function hyousei1hh(way, way2) {
  let x = 0;
  loop(way) {
   wait(180);
   loop(10) {
    wait(35);
    loop(way2) {
     CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Hard-.txt", x, GetClipMinY, 2, 90, 0);
     x = rand(GetClipMinX, GetClipMaxX);
    }
   }
  }
 }

 function hyousei1L(way) {
  plus = 1;
  loop(2) {
   wait(180);
   loop(9) {
    wait(18);
    let x = 40;
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Lunatic-.txt", Select(plus < 0, GetClipMaxX, GetClipMinX) + (x * plus), 0, 2, 90, Select(plus < 0, 1 + way * 2, way * 2));
    x += 24;
   }
   plus = -plus;
  }
 }

 function hyousei1l(way) {
  loop(2) {
  let x = GetClipMinX + 10;
  let move = 1;
   wait(120);
   loop(10) {
    wait(30);
    CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Lunatic-.txt", x, 0, 2, 90, move * way);
    x += (GetClipMaxX - 10) / 10;
    move += 1;
    if(move == 11) {
     move = 1;
     x = GetClipMinX + 10;
    }
   }
  }
 }

 function hyousei1ll(way, way2) {
  let x = GetCenterX;
  loop(way) {
   wait(180);
   loop(10) {
    wait(35);
    loop(way2) {
     CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XP-Lunatic-.txt", x, GetClipMinY, 2, 90, 0);
     x = rand(GetClipMinX, GetClipMaxX);
    }
   }
  }
 }

 function hyousei2e(way) {
  CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XQ-Easy-.txt", GetCenterX, GetClipMinY, 1, 90, way);
 }

 function hyousei2n(way) {
  CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XQ-Normal-.txt", GetCenterX, GetClipMinY, 1, 90, way);
 }

 function hyousei2h(way) {
  CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XQ-Hard-.txt", GetCenterX, GetClipMinY, 1, 90, way);
 }

 function hyousei2l(way) {
  CreateEnemyFromFile(GetCurrentScriptDirectory~"P\XQ-Lunatic-.txt", GetCenterX, GetClipMinY, 1, 90, way);
 }
#include_function ".\P\ϐW.txt"